<template>
  <div>{{dictLabel}}</div>
</template>

<script>
export default {
  name: 'DictLabel',
  data() {
    return {
      optionList: []
    }
  },
  props: {
    fieldValue: {
      type: String,
      default: ''
    }, // 字段值
    dictCode: {
      type: String,
      default: ''
    }, // 字典code
  },
  watch: {
    dictCode: {
      handler(val) {
        if(val) {
          this.getDicts(val).then(response => {
            this.optionList = response.data;
          });
        }
      },
      immediate: true
    }
  },
  computed: {
    dictLabel() {
      return this.selectDictLabel(this.optionList, this.fieldValue);
    }
  },
}
</script>

<style scoped>

</style>
